﻿using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UI.Admin
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            var username = Login1.UserName;
            var password = Login1.Password;
            var user = UserService.Login(username, password);
            if (user != null)
            {
                HttpContext.Current.Session["username"] = username;
                e.Authenticated = true;
                Response.Redirect("~/MovieList");
            }
            else
            {
                e.Authenticated = false;
            }
        }
    }
}